var t = require("../utils/util"),
  e = require("../utils/uuid.js").UUIDjs,
  r = require("../utils/murmurhash2");
module.exports = {
  getUUID: function (r, n, i) {
    var o = wx.getStorageSync(r);
    return (
      t.isEmpty(o) &&
        (wx.removeStorageSync(n),
        wx.removeStorageSync(i),
        (o = e.create().toString().split("-").join("")),
        wx.setStorageSync(r, o)),
      o
    );
  },
  cacheError: function (t, e) {
    var r;
    try {
      ((r = wx.getStorageSync("__TURING_ERROR") || {})[t] = e + ""),
        wx.setStorageSync("__TURING_ERROR", r);
    } catch (t) {}
  },
  getErrors: function () {
    var t;
    try {
      (t = wx.getStorageSync("__TURING_ERROR")) &&
        wx.removeStorageSync("__TURING_ERROR");
    } catch (t) {}
    return t;
  },
  getLocal: function (t) {
    return wx.getStorageSync(t);
  },
  setLocal: function (e, r) {
    t.isEmpty(e) || wx.setStorageSync(e, r);
  },
  delLocal: function (e) {
    t.isEmpty(e) || wx.removeStorage({ key: e });
  },
  tTokenKey: function (t) {
    return t + r.hash32("__TURING_TOKEN", 0).toString(16);
  },
  rTokenKey: function (t) {
    return t + r.hash32("__RISK_TOKEN", 0).toString(16);
  },
  tPunishKey: function (t) {
    return {
      timesk: t + r.hash32("key_turing_times_limit", 0).toString(16),
      faildk: t + r.hash32("key_turing_faild_limit", 0).toString(16),
    };
  },
  ticketKey: function (t) {
    return t + "bd7dcc4c";
  },
  uidKey: function (t) {
    return t + "f1fe7b11";
  },
  dTokenKey: function (t) {
    return t + "d29118e0";
  },
};
